package com.example.competionmanagebackend.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.competionmanagebackend.entity.Messages;
import com.example.competionmanagebackend.mapper.MessagesMapper;
import com.example.competionmanagebackend.service.MessagesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class MessagesServiceImpl extends ServiceImpl<MessagesMapper, Messages>
        implements MessagesService {

    @Resource
    private MessagesMapper messagesMapper;

    @Override
    public Page<Messages> getMessagesPage(int currentPage, int pageSize) {
        Page<Messages> page = new Page<>(currentPage, pageSize);
        return this.page(page);
    }

    @Override
    public void insertMessage(Messages message) {
        messagesMapper.insertMessage(message);
    }

    @Override
    public void updateMessage(Messages message) {
        messagesMapper.updateMessage(message);
    }

    @Override
    public void deleteMessage(Integer id) {
        messagesMapper.deleteMessageById(id);
    }
}